/**
 * +======================================================================================================================+
 * @Author: CimZzz
 * @Date: 2022-09-07 16:28:05
 * 
 * 代码分割块，以下内容涉及: 
 * 
 * VLTimer 定时器测试用例
 * 
 */
#include <cstdio>
#include "vl_timer.h"

using namespace VL;

int main(int argc, const char ** argv) {
	int i = 0;
	VLTimer timer1([&]() {
		printf("tick 1 count: %d\n", i ++);
	}, false, 5000);

	bool isRunning = true;
	while(isRunning) {
		char c = getchar();
		switch(c) {
			case 'a':
				// 启动 Timer 1
				timer1.beginSchedule();
				break;
			case 'b':
				// 停止 Timer 1
				timer1.stopSchedule();
				break;
			case 'c':
				// 立即调度一次 Timer 1
				timer1.scheduleOnce();
				break;
			case 'q':
				// 停止循环
				isRunning = false;
				break;
		}
	}

	return 0;
}
